package com.okchan.web;

/**
 * @author Ok chan
 */
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;

import com.okchan.domain.User;
import com.okchan.service.UserService;

import javax.servlet.http.HttpSession;


@RestController
@RequestMapping("web/user")
public class UserController {
    @Autowired
    private UserService userService;
    @GetMapping( "/get")
    public User get(@RequestParam(value = "id", required = false) final Long userId){
        return userService.selectUserById(userId);
    }

    @PostMapping("insert")
    public User insert(@RequestBody User user) {
        return this.userService.insertUser(user);
    }

}


